Skip to content

Fix broken sliding window logic and remove unnecessary finisher in SlidingWindowGatherer - #19290

Closed
simpanda01 wants to merge 2 commits into
eugenp:masterfrom
simpanda01:fix-sliding-window-gatherer
Closed

simpanda01 wants to merge 2 commits into
eugenp:masterfrom
simpanda01:fix-sliding-window-gatherer

Conversation

@simpanda01

Copy link
Copy Markdown
Contributor

Fixes #18683

Problem:

  • The integrator pushed the window before checking its size and unconditionally removed the first element after every push, so every emitted window had size 1 instead of forming an actual sliding window.
  • The finisher() override was a no-op, duplicating the default behavior already provided by Gatherer.

Fix:

  • Added a WINDOW_SIZE constant. Now elements are removed from the front only once the window exceeds WINDOW_SIZE, and a window is pushed downstream only once it reaches WINDOW_SIZE.
  • Removed the redundant finisher() override and unused BiConsumer import.
  • Kept ArrayDeque for O(1) removeFirst().

Testing: Verified with input 1,2,3,4,5 → correctly produces [1,2,3], [2,3,4], [3,4,5].

@lor6

lor6 commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

The SlidingWindowGatherer class is outdated; closing here.

@lor6 lor6 closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unnecessary finisher

2 participants